<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>九九乘法表</title>
    <style>
        table {
            border-collapse: collapse;
            width: 50%;
            margin: 0 auto;
        }
        td {
            border: 1px solid black;
            padding: 5px;
            text-align: center;
        }
        .odd-row {
            background-color: #DDDDDD;
        }
    </style>
</head>
<body>
    <h2 style="text-align: center;">九九乘法表</h2>
    <table id="multiplicationTable"></table>

    <script>
        function generateMultiplicationTable() {
            const table = document.getElementById('multiplicationTable');
            for (let i = 1; i <= 9; i++) {
                const row = document.createElement('tr');
                if (i % 2 !== 0) { // 奇数行
                    row.classList.add('odd-row');
                }
                for (let j = 1; j <= i; j++) {
                    const cell = document.createElement('td');
                    cell.textContent = `${j} * ${i} = ${j * i}`;
                    row.appendChild(cell);
                }
                table.appendChild(row);
            }
        }

        generateMultiplicationTable();
    </script>
</body>
</html>